<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //写入五行四列的表格，将帖子数组中数据填充到单元格中
    var arr = [
        ["第1条帖子", "a", "写入五行四列的表格，将帖子数组中数据填充到单元格中", "2021-09-01"],
        ["第2条帖子", "b", "写入五行四列的表格，将帖子数组中数据填充到单元格中", "2021-09-01"],
        ["第3条帖子", "c", "写入五行四列的表格，将帖子数组中数据填充到单元格中", "2021-09-01"],
        ["第4条帖子", "d", "写入五行四列的表格，将帖子数组中数据填充到单元格中", "2021-09-01"],
        ["第5条帖子", "e", "写入五行四列的表格，将帖子数组中数据填充到单元格中", "2021-09-01"]
    ];

    var tbHeight = "500px";
    var tbWidth = "800px";
    
    document.write("<table border='1' height='"+ tbHeight +"' width='"+ tbWidth +"'>");
    function createList(arr) {
        for(var i = 0; i < arr.length; i++) {
            document.write("<tr>");
            for(var j = 0; j < arr[0].length; j++) {
                if(j == 2) {
                    arr[i][j] = arr[i][j].slice(0, 5) + "....";
                }
                document.write("<td>");
                document.write(arr[i][j]);
                document.write("</td>");
            }
            document.write("</tr>");
        }
    }
    createList(arr);
    document.write("</table>");
</script>
</html>